﻿using ConsoleApp4;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace winForm001
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            // TODO: 这行代码将数据加载到表“adimiDataSet.Users”中。您可以根据需要移动或删除它。
            //this.usersTableAdapter.Fill(this.adimiDataSet.Users);

            string selectStr ="select * from Users";

            var dataTable = dBHelper.GetDataTable(selectStr);

            dataGridView1.DataSource = dataTable;

            MessageBox.Show("单击背景会变色哟！双击变白！");
        }

        //鼠标单击
        private void Form1_MouseClick(object sender, MouseEventArgs e)
        {
            List<Color> colors = new List<Color>();

            colors.Add(Color.Yellow);
            colors.Add(Color.Black);
            colors.Add(Color.Blue);
            colors.Add(Color.Pink);
            colors.Add(Color.Red );
            colors.Add(Color.Green );
            colors.Add(Color.Orange );

            Random random = new Random();

            var ranInt = random.Next(0,6);

            var ranColor = colors[ranInt];

            BackColor = ranColor;
            
        }


        //鼠标双击
        private void Form1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            BackColor = Color.White;
        }

        //窗口移动
        private void Form1_Move(object sender, EventArgs e)
        {
            MessageBox.Show("别移动");
        }


        //鼠标悬放
        private void Form1_MouseHover(object sender, EventArgs e)
        {
            BackColor = Color.Red;
        }


        //鼠标离开控件
        private void Form1_MouseLeave(object sender, EventArgs e)
        {
            BackColor = Color.White;
        }

        private void button1_Click(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }
    }
}
